package com.example.work6_2;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ProgressBar;


public class MainActivity extends Activity {
	private ProgressBar fB = null;
	private ProgressBar sB = null;
	private Button bt = null;
	private int i =0;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        fB = (ProgressBar)findViewById(R.id.fB);
        sB = (ProgressBar)findViewById(R.id.sB);
        bt = (Button)findViewById(R.id.bt);
        bt.setOnClickListener(new ButtonListener());
    }
    class ButtonListener implements OnClickListener {

		@Override
		public void onClick(View arg0) {
			// TODO Auto-generated method stub
			if(i==0){
				fB.setVisibility(View.VISIBLE);
				sB.setVisibility(View.VISIBLE);
				fB.setMax(150);
			}else if(i < fB.getMax()){
				fB.setProgress(i);
				fB.setSecondaryProgress(i+10);
			}else{
				fB.setVisibility(View.GONE);
				sB.setVisibility(View.GONE);
			}
			i = i + 10;
		}
    }
}

